//
//  DPTubeLineDetail.m
//  DPTubeStatus
//
//  Created by Joel Parsons on 22/11/2011.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "DPTubeLineDetail.h"
#import "DPTubeLine.h"

@implementation DPTubeLineDetail
@synthesize nameLabel;
@synthesize statusCodeLabel;
@synthesize statusDetailLabel;
@synthesize image;

@synthesize aTubeLine;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [self setImage:nil];
    [self setNameLabel:nil];
    [self setStatusCodeLabel:nil];
    [self setStatusDetailLabel:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.nameLabel.text = self.aTubeLine.name;
    self.statusCodeLabel.text = self.aTubeLine.statusCode;
    self.statusDetailLabel.text = self.aTubeLine.statusDetails;
    
    NSString * iconPath = [[NSBundle mainBundle] pathForResource:@"LTimage" ofType:@"jpg"];
    UIImage * iconImage = [UIImage imageWithContentsOfFile:iconPath];
    
    self.image.image = iconImage;
    
    
    self.title = @"Line Detail";
    
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
